package recharge_management

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/admin-api/pkg/emun"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type AutonomousTypeLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 存款类型
func NewAutonomousTypeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AutonomousTypeLogic {
	return &AutonomousTypeLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *AutonomousTypeLogic) AutonomousType() (resp *types.DepositTypeResponse, err error) {
	var emunData []types.Emun

	for key, value := range emun.AutonomousTypeMap {
		emunData = append(emunData, types.Emun{
			Key:   int32(key),
			Value: value,
		})
	}

	return &types.DepositTypeResponse{
		EmunData: emunData,
	}, nil
}
